
//判断手机号是否正确
var truePhone = function(phone){
    var message = "";
    var myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(17[0-9]{1})|(15[0-3]{1})|(15[5-9]{1})|(18[0-9]{1}))+\d{8})$/;       
    if(phone == ''){
       message = "手机号码不能为空！";
    }else if(phone.length !=11){
       message = "请输入有效的手机号码！";
    }else if(!myreg.test(phone)){
       message = "请输入有效的手机号码！";
    }
    return message;
};

var truePass = function(password){
	var str = "";
	var myPass =  /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/;
	if(password == ""){
		str = "密码不能为空";
	}else if(password.length < 6 || password.length > 16){
		str = "密码长度为6-16位";
	}else if(!myPass.test(password)){
		str = "密码必须是数字字母的混合";
	}	
	return str;
}
var testCode = function(n){
	var arr =[];
	for(i = 0;i < n;){
		arr[i] = parseInt(Math.random() * 100);
		if(arr[i] >= 0 && arr[i] <= 35 || arr[i] >=65 && arr[i] <= 90){
			if(arr[i] >= 10 && arr[i] <= 35){
			 	arr[i] += 87;
				arr[i] = String.fromCharCode(arr[i]);
				i++;
			}else if(arr[i] >=65 && arr[i] <= 90){
				arr[i] = String.fromCharCode(arr[i]);
				i++;
			}else{
				arr[i];
				i++
			}
		}
	}
		return arr.join("");	
}